'''
Created on Dec 5, 2010

@author: jackreilly
'''

from google.appengine.ext import webapp
from jettube.models import User
from google.appengine.api import users
from jettube.server.utilities.urlReference import MAIN_URL
from jettube.client.responseUtil import dumpDictionary, dumpTemplate

class RegisterUserHandler( webapp.RequestHandler ):
    def get( self ):
        userkey = User.registerUserFromRequest(self.request)
        self.response.out.write(userkey)
        
class ExtensionRegisterHandler(webapp.RequestHandler):
    def get(self):
        User.registerExtensionUserFromRequest(self.request)
        dumpTemplate( self , parameters = {} ,classType="registerExtension")
        
        
class ChromeExtensionRegisterUser(webapp.RequestHandler):
    def get(self):
        dumpDictionary(User.getChromeExtensionDictionary(self.request), self.response)
        
        
class GoogleRegister( webapp.RequestHandler ):
    def get( self ):
        userkey = User.registerUserFromGoogleUser(users.get_current_user())
        self.redirect( MAIN_URL, True )
        
        
class RequestedStationsHandler(webapp.RequestHandler):
    def get(self):
        dumpDictionary(User.getUserStationsDictFromRequest(self.request), self.response)
        
        
class RequestedStationDecisionHandler(webapp.RequestHandler):
    def get(self):
        User.registerRSDecisionFromRequest(self.request)
        self.response.out.write('success')